<template>
    <div class="div-layer">
        <div style="text-align: right;" class="mb10 mt10" v-show="op!='view'">
            <Button type="primary" :disabled="single==false"
                    @click="submit">确定
            </Button>
        </div>
        <div class="custominfo mb10">
            <Card>
                <h2 class="mb10">客户信息</h2>
                <ul class="over">
                    <li>申请编号:<span>{{mortgageInfo.camainNo}}</span></li>
                    <li>客户姓名:<span>{{mortgageInfo.borrowerName}}</span></li>
                    <li>电话号码:<span>{{mortgageInfo.customerPhone}}</span></li>
                    <li>解抵押状态:<span>{{mortgageInfo.statusmortgname}}</span></li>
                    <li>案件类别:<span>{{mortgageInfo.categoryname}}</span></li>
                    <li>案件状态:<span>{{mortgageInfo.statusName}}</span></li>
                    <li>贷款金额:<span>{{mortgageInfo.loanmoney}}</span></li>
                    <li>结清时间:<span>{{mortgageInfo.closeDate}}</span></li>
                </ul>
            </Card>
        </div>
        <div class="div-entry">
            <div>
                <Card class="datareport">
                    <h2 class="filetitle">资料清单<span>请确认是否收到该客户的以下资料</span></h2>
                    <CheckboxGroup  v-model="checkAllGroup" style="padding-left: 16px;">
                        <Checkbox :label="item.code" v-for="(item,index) in categoryList"  class="mb10" :disabled="true">{{item.name}}</Checkbox>
                    </CheckboxGroup>
                    <p v-show="op!='view'">
                        <Checkbox v-model="single" :disabled="op=='view'">我司已确认收到客户的机动车证和全套解抵押资料,承诺妥善保管，并尽快为客户办理解抵押手续</Checkbox>
                    </p>
                </Card>
            </div>
            <div>
                <Card>
                    <h2 style="margin-bottom:16px;">邮寄信息</h2>
                    <ul>
                        <li class="mb10">运单编号:<span>{{moRecord.postNo}}</span></li>
                        <li>备注:<span>{{moRecord.memo}}</span></li>
                    </ul>
                </Card>
            </div>

        </div>
    </div>
</template>
<script>
    import {get,sure} from "../../api/mortgage-filing/mortgageFilingApi";

    export default {
        data() {
            return {
                op:this.afs.getPageParams(this).op,
                sureid:"",
                single:false,
                mortgageInfo:{
                },
                categoryList:[],
                checkAllGroup:[],
                moRecord:{},
            }
        },
        created() {
            this.sureid=this.afs.getPageParams(this).id
            this.initGetMortgageFiling();
        },
        methods: {
            //获取解抵押信息
            initGetMortgageFiling() {
                let param ={
                    id:this.sureid,
                }
                get(param).then(res => {
                    if (res.code === "0000") {
                        this.mortgageInfo=res.data.mortgageInfo;
                        if(res.data.refData){
                            this.mortgageInfo.categoryname=res.data.mortgageInfo.refData.categoryname;
                            this.mortgageInfo.statusmortgname=res.data.mortgageInfo.refData.statusmortgname;
                            this.mortgageInfo.statusName=res.data.mortgageInfo.refData.statusName;
                            // console.log(this.mortgageInfo,"mortgageInfo")

                            // this.categoryList=res.data.categoryList;
                            let checkArr=[];
                            let newcategoryList=[];
                            res.data.categoryList.forEach((item,index)=>{
                                if(item.isCheck==1){
                                    newcategoryList.push(item);
                                    checkArr.push(item.code);
                                }
                            })
                            this.categoryList=newcategoryList;
                            this.checkAllGroup=checkArr;

                            this.moRecord=res.data.moRecord;
                            // this.sureid=res.data.mortgageInfo.id;
                        }
                    }
                });
            },
            submit() {
                let param={
                    id:this.sureid,
                }
                sure(param).then(res=>{
                    if(res.code=="0000"){
                        this.$Message.warning("提交成功");
                        this.closeTab();
                    }
                })
            },
            //关闭当前页面
            closeTab() {
                this.afs.closeTab(this);
            },
        }
    }
</script>
<style scoped>
    .custominfo li{
        float: left;
        width: 33.3%;
        margin-bottom: 15px;
    }
    .div-entry .filetitle{
        margin: 16px 0;
        padding-left:16px;
    }
    .div-entry .filetitle span{
        font-size: 12px;
        color:#515a6e;
        font-weight: normal;
        margin-left: 5px;
    }
    .div-entry{
        display:flex;
    }
    .div-entry>div:first-child{
        width: 65%;
        margin-right: 10px;
    }
    .div-entry>div:last-child{
        width: 35%;
    }
    .div-entry p /deep/ .ivu-checkbox-wrapper{
        width: 100%;
        line-height: 35px;
        background-color: #fcfcfc;
        padding-left: 16px;
    }
    .datareport /deep/ .ivu-card-body{
        padding:0;
    }
</style>
